package models

type Response struct {
	StatusCode ResCode `json:"status_code"`
	StatusMsg  string  `json:"status_msg,omitempty"`
}

type Model struct {
	ID uint `json:"-" gorm:"primaryKey"`
}

// Video 与前端交互数据
type Video struct {
	Id            int64  `json:"id"`
	Author        User   `json:"author"`
	PlayUrl       string `json:"play_url"`
	CoverUrl      string `json:"cover_url"`
	FavoriteCount int64  `json:"favorite_count"`
	CommentCount  int64  `json:"comment_count"`
	IsFavorite    bool   `json:"is_favorite"`
	Title         string `json:"title"`
}

// Vid 存储在数据库中
type Vid struct {
	Model
	Id            int64  `gorm:"column:video_id;uniqueIndex:video_id"`
	PlayUrl       string `gorm:"column:play_url"`
	CoverUrl      string `gorm:"column:cover_url"`
	FavoriteCount int64  `gorm:"column:favorite_count;default:0"`
	CommentCount  int64  `gorm:"column:comment_count;default:0"`
	IsFavorite    bool   `gorm:"column:is_favorite;default:false"`
	Title         string `gorm:"column:title"`
	CreateTime    int64  `gorm:"autoCreateTime"`
	UpdateTime    int64  `gorm:"autoUpdateTime"`
}

// Comment 与前端交互数据
type Comment struct {
	Id         int64  `json:"id,omitempty"`
	User       User   `json:"user"`
	Content    string `json:"content,omitempty"`
	CreateDate string `json:"create_date,omitempty"`
}

// Com 存储在数据库中
type Com struct {
	Model
	Id         int64  `gorm:"column:comment_id;uniqueIndex:comment_id"`
	Content    string `gorm:"column:content"`
	CreateTime int64  `gorm:"autoCreateTime"`
	UpdateTime int64  `gorm:"autoUpdateTime"`
}

// User 存储在数据库中  同时与前端交互数据
type User struct {
	Model
	Id            int64  `json:"id,omitempty" gorm:"column:user_id;uniqueIndex:user_id"`
	Name          string `json:"-" gorm:"column:username"`
	NickName      string `json:"name,omitempty" gorm:"column:nickname"` //返回前端的是昵称
	Password      string `json:"-" gorm:"column:password"`
	FollowCount   int64  `json:"follow_count" gorm:"column:follow_count;default:0"`
	FollowerCount int64  `json:"follower_count" gorm:"column:follower_count;default:0"`
	IsFollow      bool   `json:"is_follow" gorm:"column:is_follow;default:false"`
	CreateTime    int64  `json:"-" gorm:"autoCreateTime"`
	UpdateTime    int64  `json:"-" gorm:"autoUpdateTime"`
}
